package com.briercliffe.settlers.core.domain;

/**
* User: briercliffe
* Date: 10/21/13
*/
public class CubeCoordinates
{
    public static CubeCoordinates fromOddROffset(final int x, final int y)
    {
        CubeCoordinates cubeCoordinates = new CubeCoordinates();
        cubeCoordinates.setX(x - (y - (y % 2)) / 2);
        cubeCoordinates.setZ(y);
        cubeCoordinates.setY(-cubeCoordinates.getX() - cubeCoordinates.getZ());
        return cubeCoordinates;
    }

    private int mX, mY, mZ;

    public CubeCoordinates()
    {

    }

    public CubeCoordinates(final int iX, final int iY, final int iZ)
    {
        mX = iX;
        mY = iY;
        mZ = iZ;
    }

    public AxialCoordinates convertToAxial() {
        return new AxialCoordinates(mX, mZ);
    }

    public int getX()
    {
        return mX;
    }

    public void setX(final int iX)
    {
        mX = iX;
    }

    public int getY()
    {
        return mY;
    }

    public void setY(final int iY)
    {
        mY = iY;
    }

    public int getZ()
    {
        return mZ;
    }

    public void setZ(final int iZ)
    {
        mZ = iZ;
    }
}
